home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / pctv3n2.zip / STRINGS.PAS < prev    next >
Pascal/Delphi Source File  |  1991-12-28  |  785b  |  37 lines

  1. PROGRAM strings;
  2.   { Searches any file for printable strings }
  3.   { of 7 or more characters. Useful for extracting }
  4.   { messages and internal documentation from .EXE's. }
  5.  
  6. USES dos;
  7.  
  8. VAR infile: FILE OF char;  { not text! }
  9.     s:      string;
  10.     c:      char;
  11.  
  12. BEGIN
  13.  
  14.   IF ParamCount <> 1 THEN
  15.     BEGIN
  16.       WriteLn('You must give a filename.'); Halt
  17.     END;
  18.  
  19.   Assign(infile,ParamStr(1));
  20.   Reset(infile);
  21.  
  22.   WriteLn('>>Searching ',ParamStr(1),'<<');
  23.   WHILE NOT Eof(infile) DO
  24.     BEGIN
  25.       s := '';
  26.       Read(infile,c);
  27.       WHILE (c > #31) AND (c < #127) AND NOT Eof(infile) DO
  28.         BEGIN
  29.           s := s + c;
  30.           Read(infile,c)
  31.         END;
  32.       IF Length(s) > 6 THEN WriteLn(s);
  33.     END;
  34.   WriteLn('>>End of file<<')
  35.  
  36. END.
  37.